package com.getpebble.android.framework.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.getpebble.android.PebbleApplication;
import com.getpebble.android.common.core.trace.Trace;
import com.getpebble.android.config.SyncBootConfig;
import com.getpebble.android.notifications.util.NotificationUtil;

public class LocaleChangedReceiver extends BroadcastReceiver {
    private static final String TAG = LocaleChangedReceiver.class.getSimpleName();

    public void onReceive(Context context, Intent intent) {
        if (intent == null) {
            Trace.debug(TAG, "onReceive() intent is null");
        } else if ("android.intent.action.LOCALE_CHANGED".equals(intent.getAction())) {
            Trace.debug(TAG, "Locale changed");
            NotificationUtil.loadAndroidApps();
            SyncBootConfig.syncBootConfigIfRequired(null, PebbleApplication.getAppContext(), null, true);
        }
    }
}
